#include <verilated.h>
#include <Vysyx_22040213_mul.h>
#include <verilated_vcd_c.h>
#include <svdpi.h>
#include <verilated_dpi.h>

static Vysyx_22040213_mul* top;
VerilatedContext* contextp = NULL;
VerilatedVcdC* tfp = NULL;

void single_cycle(){
	top->clk = 0;top->eval();
	top->clk = 1;top->eval();
	  contextp->timeInc(1);
	  tfp->dump(contextp->time());
}
static void reset(int n) {
  top->rst = 0;
  while (n -- > 0) single_cycle();
  top->rst = 1;
}

void sim_init(){
	contextp = new VerilatedContext;
	top = new Vysyx_22040213_mul;
	tfp = new VerilatedVcdC;
	contextp->traceEverOn(true);
	top->trace(tfp,0);
	tfp->open("obj_dir/sim.vcd");

}

void sim_exit(){
	tfp->close();
}
int main() {
  sim_init();
  reset(10);
  top->mul_signed = 0b11;
  top->multiplicand = 0xaeb1c2aa;
  top->multiplier = 0xffffffff4500ff2b;
  top->mul_valid = 1;
  single_cycle();
  top->mul_valid = 0;
  for(int b = 0; b < 40;b++){
    single_cycle();
  }
  sim_exit();
}
